package com.dzl.order.service;

import com.dzl.admin.pojo.vo.LoginSysAdminVo;
import com.dzl.base.service.BaseService;
import com.dzl.order.pojo.WelfareOrder;
import com.dzl.order.pojo.dto.*;
import com.dzl.order.pojo.query.WelfareOrderQuery;
import com.dzl.order.pojo.query.WelfareOrderUserQuery;
import com.dzl.order.pojo.vo.WelfareOrderDetailVo;
import com.dzl.order.pojo.vo.WelfareOrderGoodsPayVo;
import com.dzl.order.pojo.vo.WelfareOrderParentVo;
import com.dzl.order.pojo.vo.WelfareOrderSupplierVo;
import com.dzl.supplier.pojo.WelfareSupplier;
import com.github.pagehelper.PageInfo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * 订单表(WelfareOrder)表服务接口
 * @author caobucao
 * @since 2021-05-18 15:36:50
 */
public interface WelfareOrderService extends BaseService<WelfareOrder> {

    /**
     * 获取各状态的订单数量
     * @param query 查询条件
     * @return java.util.List<java.lang.Integer>
     * @date 2021/5/26 17:55
     * @author caobucao
     */
    List<Integer> getOrderCount(WelfareOrderQuery query);

    /**
     * 分页查询订单列表（大订单维度）
     * @author ChenLong
     * @date 2021-09-22 15:21:30
     * @param query 查询条件
     * @return java.util.List<com.dzl.order.pojo.vo.WelfareOrderParentVo>
     **/
    PageInfo<WelfareOrderParentVo> getOrderListPage(WelfareOrderQuery query);

    /**
     * 获取子订单信息
     * @param query 搜索条件
     * @return java.util.List<com.dzl.order.pojo.vo.WelfareGoodsOrderVo>
     * @date 2021/5/29 14:22
     * @author caobucao
     */
    List<WelfareOrderSupplierVo> getOrderChildList(WelfareOrderQuery query);

    /**
     * 导出订单清单
     * @param voList
     * @return void
     * @date 2021/7/20 0020 13:35
     * @author wangjian
     */
    void exportOrderList(List<WelfareOrderSupplierVo> voList, HttpServletResponse res, HttpServletRequest req);

    /**
     * 导出订单流水清单
     * @param voList
     * @return void
     * @date 2021/7/20 0020 13:35
     * @author wangjian
     */
    void exportSaleFlow(List<WelfareOrderSupplierVo> voList, HttpServletResponse res, HttpServletRequest req);

    /**
     * 获取用户订单及订单下商品列表
     * @param query 用户订单查询实例类
     * @return java.util.List
     * @author ChenLong
     * @date 2021-05-21 18:45:32
     **/
    List<WelfareOrderSupplierVo> getOrderGoodsListByUserId(WelfareOrderUserQuery query);

    /**
     * 添加订单
     * @param welfareOrderDto 订单添加实体DTO类
     * @return int
     * @author ChenLong
     * @since 2021-05-21 13:49:53
     **/
    Map<String, Object> addUserOrder(WelfareOrderDto welfareOrderDto);

    /**
     * 更新订单信息、核销兑换券、拆单
     * @author ChenLong
     * @date 2021-09-29 15:18:52
     * @param welfareOrderExchangeDto 订单dto
     * @return java.util.Map<java.lang.String,java.lang.Object>
     **/
    Map<String, Object> updateExchangeOrderAndSplit(WelfareOrderExchangeDto welfareOrderExchangeDto);

    /**
     * 获取订单详情
     * @param orderId 订单id
     * @param dataPort 数据显示端口：1服务端 2小程序端 3企业端
     * @return java.util.List
     * @author ChenLong
     * @since 2021-05-21 18:38:48
     **/
    WelfareOrderDetailVo getOrderDetailByOrderId(Integer orderId, Integer dataPort);

    /**
     * 获取订单支付卡商品默认匹配结果
     * @param userId  用户id
     * @param orderId 订单id
     * @return java.util.Map
     * @author ChenLong
     * @date 2021-06-07 19:51:28
     **/
    Map<String, Object> addOrderGoodsPayMatchByOrderId(Integer userId, Integer orderId);

    /**
     * 订单支付卡商品匹配结果重新计算
     * @param userId                       用户id
     * @param welfareOrderGoodsPayMatchDto 匹配结果实体
     * @return com.dzl.order.pojo.vo.WelfareOrderPayVo
     * @author ChenLong
     * @date 2021-06-08 15:56:54
     **/
    WelfareOrderGoodsPayVo addOrderGoodsPayMatchReDefine(Integer userId, WelfareOrderGoodsPayMatchDto welfareOrderGoodsPayMatchDto);

    /**
     * 订单提交
     * @param userId                       用户id
     * @param welfareOrderGoodsPayMatchDto 匹配结果实体
     * @return com.dzl.order.pojo.vo.WelfareOrderPayVo
     * @author ChenLong
     * @date 2021-06-08 15:56:54
     **/
    Integer addOrderConfirmForPay(Integer userId, WelfareOrderGoodsPayMatchDto welfareOrderGoodsPayMatchDto);

    /**
     * 订单支付提交
     * @param orderId 订单id
     * @param type    提交类型
     * @param openId  微信openId
     * @return java.util.Map
     * @author ChenLong
     * @date 2021-05-28 16:48:22
     **/
    Map addPaymentExecute(Integer orderId, Integer type, String openId);

    /**
     * 更新订单信息及拆单
     * @param welfareOrderRes 订单实体
     * @return java.lang.Integer
     * @author ChenLong
     * @date 2021-06-18 17:04:59
     **/
    void updateOrderAndSplitForPay(WelfareOrder welfareOrderRes);

    /**
     * 订单支付完以后发送短信（补差）
     * @param welfareOrder 订单相关参数实体类
     * @return void
     * @author ChenLong
     * @date 2021-07-20 16:59:04
     **/
    void sendMessageForPayByOrder(WelfareOrder welfareOrder);

    /**
     * 订单超时取消
     * @return java.lang.Integer
     * @author ChenLong
     * @date 2021-06-06 16:01:43
     **/
    Integer updateOrderCancelExpiredTime();

    /**
     * 取消订单
     * @param welfareOrderCancelDto 订单实体
     * @author ChenLong
     * @date 2021-06-22 21:06:55
     * @return java.lang.Integer
     **/
    Integer cancelOrderByOrderId(WelfareOrderCancelDto welfareOrderCancelDto);

    /**
     * 更新订单标记
     * @author ChenLong
     * @date 2021-09-22 11:17:29
     * @param welfareOrderSignUpdDro 订单标记实体类
     * @return java.lang.Integer
     **/
    Integer updateOrderRemark(WelfareOrderSignUpdDro welfareOrderSignUpdDro);

    /**
     * 获取订单供应商列表
     * @author ChenLong
     * @date 2021-09-24 15:23:51
     * @param query 查询条件
     * @return java.util.List<com.dzl.supplier.pojo.WelfareSupplier>
     **/
    PageInfo<WelfareSupplier> getOrderSupplierListPage(WelfareOrderQuery query);

    /**
     * 批量发货
     * @param admin   操作员
     * @param dtoList 批量发货的数据
     * @return com.dzl.util.JsonResult<java.lang.Integer>
     * @date 2021/5/27 17:08
     * @author caobucao
     */
    Integer batchDelivery(List<OrderBatchDeliveryDto> dtoList, LoginSysAdminVo admin);

    /**
     * 单订单发货
     * @param dtoList 发货对象
     * @param adminVo 操作员
     * @return java.lang.Integer
     * @date 2021/5/31 9:40
     * @author caobucao
     */
    Integer orderDelivery(List<OrderBatchDeliveryDto> dtoList, LoginSysAdminVo adminVo);

    /**
     * 取消订单
     * @param welfareOrder 取消订单对象
     * @return java.lang.Integer
     * @date 2021/5/31 10:32
     * @author caobucao
     */
    Integer cancelOrder(WelfareOrder welfareOrder);

    /**
     * 订单退款
     * @param welfareOrder 退款订单对象
     * @return java.lang.Integer
     * @date 2021/5/31 16:48
     * @author caobucao
     */
    Integer updateRefundOrder(WelfareOrder welfareOrder);

    /**
     * 订单T+7发货
     * @return java.lang.Integer
     * @date 2021/7/5 9:31
     * @author caobucao
     */
    Integer updateOrderDelivery();

    /**
     * 更改订单商品供应商
     * @author ChenLong
     * @date 2021-10-18 17:36:08
     * @param welfareOrderSupplierUpdDto 订单供应商对象
     * @return void
     **/
    void updateOrderGoodsSupplier(WelfareOrderSupplierUpdDto welfareOrderSupplierUpdDto);

    /**
     * 批量修改订单信息，包括结算状态，回执单等
     * @param welfareOrderBatchUpdateDto 订单修改对象
     * @date 2021/10/13 18:00
     * @author liuguanjun
     */
    Integer batchUpdateOrderByIds(WelfareOrderBatchUpdateDto welfareOrderBatchUpdateDto);

    /**
     * 批量推送财务打款
     * @param welfareOrderPaymentPushDto 打款信息参数
     * @param adminVo 当前saas后台用户
     * @date 2021/10/14 11:48
     * @author liuguanjun
     */
    Integer batchPushOrderPayment(WelfareOrderPaymentPushDto welfareOrderPaymentPushDto,LoginSysAdminVo adminVo);
}

